package game.gui;


import javax.swing.JList;
import javax.swing.JPanel;

/**
 * A component on the Game UI hold all the available words to be found
 * in the result sets. 
 * Is-A JPanel
 * Has-A array of JList
 * Has-A 2D array of String
 * 
 * @author Ying
 *
 */
class WordList extends JPanel{
	
	/**
	 * update this 2D array when user submit a new word, and 
	 */
	String[][] wordsVectorArr ;
	JList[] wordListArr ;
	
	WordList(){
		//super(new BorderLayout());
		wordsVectorArr = new String[7][];
		wordListArr = new JList[7];
		
		//set layout
	}
	
	/**
	 * 
	 *    0   - null
	 *    1   - null 
	 *    2   - null
	 *    3   - string[] of three letter words 
	 *    4   - string [] of four letter words  
	 *    5   - string [] of five ltters words 
	 *    6   - string [] of six letter words 
	 * 
	 */
	void loadList( int[] resultArr ){
		
		String [] displayArr =  {null, null, null, "???", "????",
				"?????", "??????"};
		this.removeAll();
		for(int i=3; i<7; i++){
			wordsVectorArr[i] = new String [resultArr[i]];
			//wordsVectorArr[i] = new Vector<String>();
			for(int j=0 ; j<resultArr[i]; j++){
				wordsVectorArr[i][j] = displayArr[i];
				
			}
			
			wordListArr[i] = new JList(wordsVectorArr[i]);
			//wordListArr[i].setFixedCellHeight(20);
			wordListArr[i].setFixedCellWidth(i*10);
			wordListArr[i].setFont(Style.listLetterFont);

			this.add(wordListArr[i]);
		}
		
	}

	
}
